package controllers;

import play.mvc.*;
import play.mvc.Http.*;

public class Secured extends Security.Authenticator {
	
    public String getUsername(Context ctx) {
    	String adm = ctx.session().get("login");
    	
    	if(adm.equalsIgnoreCase("administrador")){
    		return null;
    	}
            //return ctx.session().get("login");
    	return ctx.session().get("login");
    }
    
    public Result onUnauthorized(Context ctx) {
            return redirect(controllers.routes.Application.login());
    }
}